package com.lzq.transdemo.controller;

import com.lzq.transdemo.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/user")
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/registry")
    public boolean registry(String userName,String password) {
        log.info("registry接收参数:{},{}",userName,password);
        if (!StringUtils.hasLength(userName) || !StringUtils.hasLength(password)) {
            log.warn("传入参数不合法");
            return false;
        }
        Integer result = userService.registry(userName,password);
        return !(result==0);
    }
}
